package cn.rubbit.entity;

import java.util.HashMap;
import java.util.Map;

public class Entity extends BaseBean{
	private String type;
	private String setName;
	private String className;

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getSetName() {
		return setName;
	}

	public String getClassName() {
		return className;
	}

	public void setClassName(String className) {
		this.className = className.toLowerCase();
		int index = className.indexOf('_');
		StringBuffer sb = new StringBuffer();
		if (index < 0) {
			sb.append(this.className.substring(0, 1).toUpperCase()).append(this.className.substring(1));
		} else {
			String[] newNames = this.className.split("_");
			for (String str : newNames) {
				sb.append(str.substring(0, 1).toUpperCase()).append(str.substring(1));
			}
		}
		this.setName = sb.toString();
	}

	@Override
	public Map<String, Object> toMap() {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("type", getType());
		map.put("setname", getSetName());
		map.put("classname", getClassName());
		return map;
	}
}
